<!-- 微地貌测量面-面 -->
<template>
    <el-drawer v-model="addDrawer" size="45%" :show-close="false" @opened="openDrawer" @close="closeDrawer">
        <template #title>
            <el-space direction="vertical" class="space-width100">
                <div v-if="route.path.includes('dataIntegrate') && form.qcOpinion">
                    <el-form :model="form" :inline="true" label-width="140px">
                        <el-form-item label="质检不通过原因" style="width: 100%">
                            <el-input v-model="form.qcOpinion" type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" resize="none"
                                clearable></el-input>
                        </el-form-item>
                    </el-form>
                </div>
                <h2>
                    <el-row justify="space-between">
                        <span><svg-icon icon-class="list"></svg-icon><span style="padding-left: 15px">{{ typeName }}</span></span>
                        <div>
                            <el-button type="primary" @click="confirmClick" :disabled="drawerLoading" v-if="isShowSave">保存</el-button>
                            <el-button type="primary" @click="closeDrawer">关闭</el-button>
                        </div>
                    </el-row>
                </h2>
            </el-space>
        </template>
        <template #default>
            <el-form :model="form" ref="addRef" :inline="true" :rules="formRules" label-width="140px"
                v-loading="drawerLoading">
                <el-row justify="space-between">
                    <el-form-item label="省">
                        <el-input v-model="form.province" clearable disabled></el-input>
                    </el-form-item>
                    <el-form-item label="市">
                        <el-input v-model="form.city" clearable disabled></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="区/县">
                        <el-input v-model="form.county" clearable disabled></el-input>
                    </el-form-item>
                    <el-form-item label="测量区域编号" prop="id">
                        <el-input v-model="form.id" placeholder="请输入测量区域编号" clearable maxlength="17"></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="微地貌测量工程编号" prop="geomorphySvyPrjId">
                        <el-input v-model="form.geomorphySvyPrjId" placeholder="请输入微地貌测量工程编号" clearable
                            maxlength="17"></el-input>
                    </el-form-item>
                    <el-form-item label="野外编号" prop="fieldId">
                        <el-input v-model="form.fieldId" placeholder="请输入野外编号" clearable maxlength="50"></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="测量区域名称" prop="name">
                        <el-input v-model="form.name" placeholder="请输入测量区域名称" clearable maxlength="50"></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="地貌面分析结果图图像文件编号" prop="profileAiid" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <el-input v-model="form.profileAiid" placeholder="地貌面分析结果图图像文件编号" clearable
                                maxlength="20"></el-input>
                        </el-space>
                    </el-form-item>
                    <el-form-item label=" " prop="profileAiidId" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <ImageUpload v-model="form.profileAiidName" @uploadImage="uploadSuccess('profileAiid', $event)"
                                @delImage="deleteFile('profileAiid', $event)" />
                        </el-space>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="地貌面结果图文件原始文件编号" prop="profileArwid" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <el-input v-model="form.profileArwid" placeholder="地貌面结果图文件原始文件编号" clearable
                                maxlength="20"></el-input>
                        </el-space>
                    </el-form-item>
                    <el-form-item label=" " prop="profileArwidId" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <FileUpload v-model="form.profileArwidName" @uploadFile="uploadSuccess('profileArwid', $event)"
                                @delFile="deleteFile('profileArwid', $event)" />
                        </el-space>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="典型照片文件编号" prop="photoAiid" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <el-input v-model="form.photoAiid" placeholder="典型照片文件编号" clearable maxlength="20"></el-input>
                        </el-space>
                    </el-form-item>
                    <el-form-item label=" " prop="photoAiidId" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <ImageUpload v-model="form.photoAiidName" @uploadImage="uploadSuccess('photoAiid', $event)"
                                @delImage="deleteFile('photoAiid', $event)" />
                        </el-space>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="典型照片原始文件编号" prop="photoArwid" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <el-input v-model="form.photoArwid" placeholder="典型照片原始文件编号" clearable
                                maxlength="20"></el-input>
                        </el-space>
                    </el-form-item>
                    <el-form-item label=" " prop="photoArwidId" style="width:100%">
                        <el-space direction="vertical" alignment="flex-start" :size="15" class="upload-space">
                            <FileUpload v-model="form.photoArwidName" @uploadFile="uploadSuccess('photoArwid', $event)"
                                @delFile="deleteFile('photoArwid', $event)" />
                        </el-space>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="PhotoViewingTo" prop="photoViewingTo">
                        <el-input-number v-model="form.photoViewingTo" placeholder="请输入PhotoViewingTo"></el-input-number>
                    </el-form-item>
                    <el-form-item label="拍摄者" prop="photographer">
                        <el-input v-model="form.photographer" placeholder="请输入拍摄者" clearable maxlength="17"></el-input>
                    </el-form-item>
                </el-row>
                <el-row justify="space-between">
                    <el-form-item label="备注-测量面描述及目的" prop="commentInfo" style="width:100%">
                        <el-input v-model="form.commentInfo" placeholder="请输入备注" :autosize="{ minRows: 6, maxRows: 12 }"
                            type="textarea" show-word-limit maxlength="2147483647" clearable></el-input>
                    </el-form-item>
                </el-row>
            </el-form>
        </template>
    </el-drawer>
</template>
<script setup>
// 引入基础方法
import useSpatialData from '@/hooks/useSpatialData';
// 引入表单验证规则
import { fourInt } from '@/utils/validate';
const { route, addDrawer, drawerLoading, form, typeName, openDrawer, closeDrawer, confirmClick, uploadSuccess, deleteFile, isShowSave } = useSpatialData();
// 表单验证规则
const formRules = {
    id: [{ required: true, message: '请输入测量区域编号！', trigger: 'blur' }],
    geomorphySvyPrjId: [{ required: true, message: '请输入微地貌测量工程编号', trigger: 'blur' }],
    fieldId: [{ required: true, message: '请输入野外编号', trigger: 'blur' }],
    photoViewingTo: [fourInt],
}
</script>